package happy.study.clique.module.study.design.single.code;

/**
 * 饿汉式单例,double check
 *
 * @author fsq
 * @date 2021/11/11 17:19
 **/
public class SingleTwo {

    private SingleTwo() {
    }

    private static SingleTwo SINGLETWO;

    public static SingleTwo getSingleTwo() {

        if (SINGLETWO == null) {

            synchronized (SingleTwo.class) {
                if (SINGLETWO == null) {
                    SINGLETWO = new SingleTwo();
                }
                return SINGLETWO;
            }
        }
        return SINGLETWO;
    }
}
